package com.xayy.mgt.model;


import cn.kawins.mybatis.base.BaseDataModel;
import cn.kawins.mybatis.interceptor.FillingCreateTime;
import cn.kawins.mybatis.interceptor.InsertAutoFilling;
import cn.kawins.mybatis.interceptor.UpdateAutoFilling;
import cn.kawins.mybatis.util.SnowflakeId;
import cn.kawins.spring.mvc.validator.Group;
import io.swagger.annotations.ApiModelProperty;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;
import java.util.List;
import lombok.*;

@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@Table(name = "health_xw.t_node_info_relation")
public class NodeInfoRelation extends BaseDataModel<Long> {

    @Id
    @Column(name = "id")
    @KeySql(genId = SnowflakeId.class)
    @ApiModelProperty(value = "主键ID")
    @Null(message = "新增时ID为null",groups = Group.Insert.class)
    @NotNull(message = "ID不能为空",groups = {Group.Update.class})
    private Long id;

    @ApiModelProperty(value = "卫星id")
    @Column(name = "satellite_id")
    private Long satelliteId;

    /**
     * 源
     */
    @ApiModelProperty(value = "源")
    @Column(name = "satellite_from")
    @NotNull(message = "from不能为空",groups = {Group.Insert.class,Group.Update.class})
    private Long from;

    /**
     * 目标
     */
    @ApiModelProperty(value = "目标")
    @Column(name = "satellite_to")
    @NotNull(message = "to不能为空",groups = {Group.Insert.class,Group.Update.class})
    private Long to;

    /**
     * 目标
     */
    @Transient
    @ApiModelProperty(value = "ids")
    private String ids;

    @Transient
    @ApiModelProperty(value = " subIds")
    private List<Long> subIds;

    /**
     * 创建时间
     */
    @Column(name = "created_time")
    @InsertAutoFilling(value = FillingCreateTime.class)
    @ApiModelProperty(value = "创建时间", accessMode = ApiModelProperty.AccessMode.READ_ONLY, example = "2010-01-01 00:00:00")
    private Date createdTime;
    /**
     * 更新时间
     */
    @Column(name = "updated_time")
    @UpdateAutoFilling(value = FillingCreateTime.class)
    @ApiModelProperty(value = "最后更新时间", accessMode = ApiModelProperty.AccessMode.READ_ONLY, example = "2010-01-01 00:00:00")
    private Date updatedTime;

    @Override
    public Long idValue() {
        return id;
    }
}
